home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / maxsutils.lha / MaxUtils / FileListGen12.lha / nofragli.lha / Source / library.s next >
Text File  |  1992-05-15  |  5KB  |  180 lines

  1.         opt     l+,o+,ow-,inconce
  2.  
  3. *-- AutoRev header do NOT edit!
  4. *
  5. *   Program         :   library.s
  6. *   Copyright       :   ⌐ Copyright 1991-92 Jaba Development
  7. *   Author          :   Jan van den Baard
  8. *   Creation Date   :   06-Apr-91
  9. *   Current version :   2.2
  10. *   Translator      :   Devpac version 3.01
  11. *
  12. *   REVISION HISTORY
  13. *
  14. *   Date          Version         Comment
  15. *   ---------     -------         ------------------------------------------
  16. *   12-Apr-92     2.2             Hopefully enforcer and mungwall free.
  17. *   19-May-91     2.1             Added 'Vec' routines.
  18. *   06-Apr-91     1.1             Initial version!
  19. *
  20. *-- REV_END --*
  21.  
  22.         incdir      'sys:Asm20/'
  23.         include     'exec/types.i'
  24.         include     'exec/initializers.i'
  25.         include     'exec/alerts.i'
  26.         include     'exec/io.i'
  27.         include     'exec/libraries.i'
  28.         include     'exec/resident.i'
  29.         include     'exec/strings.i'
  30.         include     'exec/exec_lib.i'
  31.         include     'dos/dos.i'
  32.         include     'dos/dos_lib.i'
  33.         include     'mymacros.i'
  34.  
  35.         STRUCTURE   NoFragBase,LIB_SIZE
  36.         LABEL       nfb_SIZEOF
  37.  
  38. VERSION             EQU     2
  39. REVISION            EQU     2
  40.  
  41. _SysBase            EQU     $0004
  42.  
  43.         xref        GetMemoryChain
  44.         xref        AllocItem
  45.         xref        FreeItem
  46.         xref        FreeMemoryChain
  47.  
  48.         xref        AllocVecItem
  49.         xref        FreeVecItem
  50.  
  51.         SECTION     "LIB_SKELL",CODE
  52.  
  53.         lea         dosname(pc),a1
  54.         cldat       d0
  55.         move.l      (_SysBase).w,a6
  56.         libcall     OpenLibrary
  57.         move.l      d0,a6
  58.         tst.l       d0
  59.         beq.s       nolib
  60.         libcall     Output
  61.         move.l      d0,d1
  62.         beq.s       noout
  63.         move.l      #idString,d2
  64.         move.l      idSize,d3
  65.         libcall     Write
  66. noout:  move.l      a6,a1
  67.         move.l      (_SysBase).w,a6
  68.         libcall     CloseLibrary
  69. nolib:  moveq       #RETURN_FAIL,d0
  70.         rts
  71.  
  72. ROMTag:
  73.         dc.w        RTC_MATCHWORD
  74.         dc.l        ROMTag
  75.         dc.l        EndCode
  76.         dc.b        RTF_AUTOINIT
  77.         dc.b        VERSION
  78.         dc.b        NT_LIBRARY
  79.         dc.b        0
  80.         dc.l        libraryName
  81.         dc.l        idString
  82.         dc.l        Init
  83. EndCode:
  84.         dc.w        0
  85.  
  86. libraryName:
  87.         dc.b        'nofrag.library',0
  88.         even
  89. idString:
  90.         dc.b        CR,LF,' NOFRAG_LIB 2.2 (12-Apr-1992)'
  91.         dc.b        ' ⌐ Copyright 1991-92 Jaba Development.',CR,LF
  92.         dc.b        ' Written with the Devpac Assembler'
  93.         dc.b        ' version 3.01 by Jan van den Baard.',CR,LF,CR,LF,0
  94. idEnd:  even
  95. idSize: dc.l        (idEnd-idString-1)
  96. dosname:
  97.         dc.b        'dos.library',0
  98.         even
  99.  
  100. Init:
  101.         dc.l        nfb_SIZEOF
  102.         dc.l        funcTable
  103.         dc.l        dataTable
  104.         dc.l        InitLib
  105.  
  106. funcTable:
  107.         dc.l        OpenLib
  108.         dc.l        CloseLib
  109.         dc.l        ExpungeLib
  110.         dc.l        ExtFuncLib
  111.  
  112.         dc.l        GetMemoryChain
  113.         dc.l        AllocItem
  114.         dc.l        FreeItem
  115.         dc.l        FreeMemoryChain
  116.  
  117.         dc.l        AllocVecItem
  118.         dc.l        FreeVecItem
  119.  
  120.         dc.l        -1
  121.  
  122. dataTable:
  123.         INITBYTE    LH_TYPE,NT_LIBRARY
  124.         INITLONG    LN_NAME,libraryName
  125.         INITBYTE    LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  126.         INITWORD    LIB_VERSION,VERSION
  127.         INITWORD    LIB_REVISION,REVISION
  128.         INITLONG    LIB_IDSTRING,idString
  129.         dc.l        0
  130.  
  131. InitLib:
  132.         move.l      a0,_SegList
  133. Done:   rts
  134.  
  135. OpenLib:
  136.         inc.w       LIB_OPENCNT(a6)
  137.         bclr        #LIBB_DELEXP,LIB_FLAGS(a6)
  138.         move.l      a6,d0
  139.         rts
  140.  
  141. CloseLib:
  142.         cldat       d0
  143.         dec.w       LIB_OPENCNT(a6)
  144.         bne.s       ret
  145.         btst        #LIBB_DELEXP,LIB_FLAGS(a6)
  146.         beq.s       ret
  147.         bsr.s       ExpungeLib
  148. ret:    rts
  149.  
  150. ExpungeLib:
  151.         movem.l     d2/a5/a6,-(sp)
  152.         tst.w       LIB_OPENCNT(a6)
  153.         beq.s       NDLex
  154.         bset        #LIBB_DELEXP,LIB_FLAGS(a6)
  155.         cldat       d0
  156.         bra.s       DLex
  157. NDLex:  move.l      a6,a5
  158.         move.l      (_SysBase).w,a6
  159.         move.l      a5,a1
  160.         libcall     Remove
  161.         move.l      _SegList,d2
  162.         movea.l     a5,a1
  163.         cldat       d0
  164.         move.w      LIB_NEGSIZE(a5),d0
  165.         suba.l      d0,a1
  166.         add.w       LIB_POSSIZE(a5),d0
  167.         libcall     FreeMem
  168.         move.l      d2,d0
  169. DLex:   movem.l     (sp)+,d2/a5/a6
  170.         rts
  171.  
  172. ExtFuncLib:
  173.         cldat       d0
  174.         rts
  175.  
  176. _SegList:
  177.         dc.l        0
  178.  
  179.         end
  180.